﻿function SelectAll(spanChk, listId) {

    var hidSelected = $("input[id='" + listId + "']");
    var chkList = $("input[refer='chk']");
    var str = "";

    for (var i = 0; i < chkList.length; i++) {
        var chk = chkList[i];
        chk.checked = spanChk.checked;
        if (chk.checked) {
            str = str + $(chk).attr("itemid") + "_";
        }
    }
    str = str == "" ? "" : str.substring(0, str.length - 1);
    hidSelected.attr("value", str);
    //alert(hidSelected.val());
}

function SelectOne(listId) {
    var hidSelected = $("input[id='" + listId + "']");
    var chkList = $("input[refer='chk']");
    var str = "";

    for (var i = 0; i < chkList.length; i++) {
        var chk = chkList[i];
        if (chk.checked) {
            str = str + $(chk).attr("itemid") + "_";
        }
    }
    str = str == "" ? "" : str.substring(0, str.length - 1);
    hidSelected.attr("value", str);
}

function myDateFormatter(dateObject) {
    var d = new Date(dateObject);
    var day = d.getDate();
    var month = d.getMonth() + 1;
    var year = d.getFullYear();
    var hours = d.getHours();
    var minute = d.getMinutes();
    var second = d.getSeconds()
    if (day < 10) {
        day = "0" + day;
    }
    if (month < 10) {
        month = "0" + month;
    }
    var date = month + "/" + day + "/" + year + " " + hours + ":" + minute + ":" + second;
    return date;
};